<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        /* 公共代码 */
        .wp {
            border: 1px solid red;
            width: 300px;
            height: 300px;
            /* 1 */
            /* position: relative; */
            /* 2 */
            /* display: table-cell;
            text-align: center;
            vertical-align: middle; */
            /* 3 */
            /* display: flex;
            justify-content: center;
            align-items: center; */
            /* 4 */
            display: grid;
        }

        .box {
            background: green;
            /* 1 */
            /* position: absolute;
            top: 0;
            right: 0;
            bottom: 0;
            left: 0;
            margin: auto; */
            /* 2 */
            /* display: inline-block; */
            /* 4 */
            align-self: center;
            justify-self: center;
        }

        .box.size {
            width: 100px;
            height: 100px;
        }

        /* 公共代码 */
    </style>
</head>

<body>
    <div class="wp">
        <div class="box size">123123</div>
    </div>

</body>

</html>